<html>
<head><meta charset="utf-8"><title>path-shorthands · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html">path-shorthands</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225582420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225582420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225582420">(Feb 08 2021 at 17:55)</a>:</h4>
<p>Hi folks! Just wanted to follow up on <a href="https://github.com/rust-lang/cargo/pull/9144">https://github.com/rust-lang/cargo/pull/9144</a> — is the best next step to discuss that PR with the goal of landing it under an experimental flag, or for me to write an RFC? I'm happy to do the latter, but don't want to get ahead of myself if the approach is deemed fundamentally undesirable :)</p>



<a name="225594643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225594643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225594643">(Feb 08 2021 at 19:25)</a>:</h4>
<p>I like the concept.</p>



<a name="225594828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225594828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225594828">(Feb 08 2021 at 19:26)</a>:</h4>
<p>I have one issue with specific syntax, namely that I would rather not see the shorthand in-band in the path field for several reasons. Primarily, depending on platform, almost any character can appear in a valid path. I would prefer to see the "base" mentioned in a separate key, and then just a relative path in the path field.</p>



<a name="225595088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595088">(Feb 08 2021 at 19:28)</a>:</h4>
<p>So instead of <code>path="devdir::xyz/abc"</code>, I would prefer something like <code>path="xyz/abc" base="devdir"</code>.</p>



<a name="225595342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595342">(Feb 08 2021 at 19:30)</a>:</h4>
<p>Other than that, the idea and rationale seem completely reasonable to me.</p>



<a name="225595440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595440">(Feb 08 2021 at 19:31)</a>:</h4>
<p>I went with <code>::</code> to resemble module syntax, but had the same thought of you. I only didn't do it because it feels a bit odd to have a field like "base" that is dedicated just to <code>path</code>. But I suppose we have precedent in <code>git</code> with <code>branch</code>, so I'll get started on that change!</p>



<a name="225595589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595589">(Feb 08 2021 at 19:32)</a>:</h4>
<p>Two things. First, you may not want to get started changing that until you hear agreement or disagreement from someone other than just me. ;)</p>



<a name="225595670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595670">(Feb 08 2021 at 19:32)</a>:</h4>
<p>And second, base might not necessarily be limited to just path. In theory you could have a base for git repo paths for instance.</p>



<a name="225595735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595735">(Feb 08 2021 at 19:33)</a>:</h4>
<p>Another option is <code>relative_to</code></p>



<a name="225595772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595772">(Feb 08 2021 at 19:33)</a>:</h4>
<p>Given that you're trying to provide a shorthand, I think it'll be reasonable for the key name to be relatively short. :)</p>



<a name="225595832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595832">(Feb 08 2021 at 19:34)</a>:</h4>
<p><code>rt</code> :p</p>



<a name="225595955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595955">(Feb 08 2021 at 19:35)</a>:</h4>
<p>The thought of making it a separate field had crossed my mind as well. Definitely feels easier to document.</p>



<a name="225595962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225595962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225595962">(Feb 08 2021 at 19:35)</a>:</h4>
<p><code>git="xyz" base="g"</code> where <code>g="https://github.com/username/"</code> for instance.</p>



<a name="225596108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225596108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225596108">(Feb 08 2021 at 19:36)</a>:</h4>
<p>This gets complicated, though, for dependencies where you provide both a git url and a local path, though.</p>



<a name="225596322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225596322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225596322">(Feb 08 2021 at 19:38)</a>:</h4>
<p>Yeah, I think we want to leave git bases for later</p>



<a name="225597080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225597080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225597080">(Feb 08 2021 at 19:45)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> Made the change to <code>base = </code> :)</p>



<a name="225627079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225627079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225627079">(Feb 08 2021 at 23:55)</a>:</h4>
<p>I just went ahead and wrote the RFC <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span>  <a href="https://github.com/rust-lang/rfcs/pull/3074">https://github.com/rust-lang/rfcs/pull/3074</a></p>



<a name="225629603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225629603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225629603">(Feb 09 2021 at 00:25)</a>:</h4>
<p>Someone made the good suggestion (I think) that if <code>base</code> is specified but _not_ <code>path</code>, maybe we could infer the <code>path</code> from the dependency name? Or the package name maybe more accurately. What do you think?</p>



<a name="225629625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225629625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225629625">(Feb 09 2021 at 00:25)</a>:</h4>
<p>That is, if you wrote</p>
<div class="codehilite"><pre><span></span><code>foo = { base = &quot;vendor&quot; }
</code></pre></div>
<p>It would pull <code>${vendor}/foo</code></p>



<a name="225630273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225630273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brendan Cully <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225630273">(Feb 09 2021 at 00:35)</a>:</h4>
<p>what about something like</p>
<div class="codehilite"><pre><span></span><code>[base]
vendor1 = { path = &quot;/foo&quot; }
vendor2 = { git = &quot;http://github.com/bar&quot; }

[dependencies]
foo = { base = &quot;vendor1&quot; }
bar = { base = &quot;vendor2&quot;, name = &quot;bar.git&quot; }
</code></pre></div>



<a name="225665953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225665953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225665953">(Feb 09 2021 at 09:58)</a>:</h4>
<p>Presumably it might be more natural in that case to have <code>/</code> in the base rather than in the path, though</p>



<a name="225665982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225665982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225665982">(Feb 09 2021 at 09:59)</a>:</h4>
<p>(hey <span class="user-mention" data-user-id="318862">@Brendan Cully</span> :))</p>



<a name="225764533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/225764533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pachi <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#225764533">(Feb 09 2021 at 22:01)</a>:</h4>
<p>hey! two of the greatest hg hackers around!</p>



<a name="226588679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226588679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226588679">(Feb 16 2021 at 22:30)</a>:</h4>
<p>I'd like to add to this discussion that if <a href="https://github.com/rust-lang/cargo/issues/5539#issuecomment-779997599">https://github.com/rust-lang/cargo/issues/5539#issuecomment-779997599</a> worked out, then I wouldn't actually need path shorthands, since the build system could just inject appropriate patches instead. I'm personally leaning more towards the "split <code>Cargo.toml</code>" approach in that issue than path shorthands at the moment, though I think they are both valuable in their own right.</p>



<a name="226611415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226611415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226611415">(Feb 17 2021 at 04:10)</a>:</h4>
<p><span class="user-mention" data-user-id="120054">@Jon Gjengset</span> Really not a fan of the <code>Cargo.toml.d</code> approach, not least of which because everything that processes <code>Cargo.toml</code> would have to understand it.</p>



<a name="226611460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226611460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226611460">(Feb 17 2021 at 04:10)</a>:</h4>
<p>But I do like the idea of being able to add <code>[patch]</code> sections in Cargo config.</p>



<a name="226611524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226611524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226611524">(Feb 17 2021 at 04:11)</a>:</h4>
<p>That would help, for instance, when rebuilding several crates with a modified/updated crate version, for testing purposes.</p>



<a name="226611572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226611572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226611572">(Feb 17 2021 at 04:12)</a>:</h4>
<p>It would also help in cases where people try to use a directory registry to hold modified sources.</p>



<a name="226611586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226611586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226611586">(Feb 17 2021 at 04:12)</a>:</h4>
<p>I'm <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span> for <code>[patch]</code> in <code>.cargo/config</code>.</p>



<a name="226696674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226696674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226696674">(Feb 17 2021 at 17:49)</a>:</h4>
<p>Wouldn't any tool that processes a <code>Cargo.toml</code> need to know about any modification we make to <code>Cargo.toml</code>? And if we allow <code>[patch]</code> in <code>.cargo/config</code>, they'd likely need to know about that now too?</p>



<a name="226696682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226696682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226696682">(Feb 17 2021 at 17:49)</a>:</h4>
<p>I don't know if you saw <span class="user-mention" data-user-id="116015">@Alex Crichton</span>'s comment further up in that issue, but he seems to be fairly against having system-wide patches in the form of <code>.cargo/config</code>, which is why I proposed placing it alongside <code>Cargo.toml</code> instead (so that the patches remain project-local).</p>



<a name="226696690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226696690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jon Gjengset <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226696690">(Feb 17 2021 at 17:49)</a>:</h4>
<p>I am very in favor of finding _some_ way to enable this kind of "external patching", and in my case it doesn't actually matter whether it's system-wide or project local — the external build system can make use of either.</p>



<a name="226698168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/path-shorthands/near/226698168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/path-shorthands.html#226698168">(Feb 17 2021 at 17:59)</a>:</h4>
<p>I didn't see the objection to system-wide patching, no.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>